//查看教练回复


import React, { useEffect, useState } from 'react';
import { Layout, List, Avatar } from 'antd';
import { getCoachMessageAPI } from '@/api/student';
import { getuserName } from '@/utils';

const { Header, Content } = Layout;

const CoachReply = () => {
  // 假设这是教练回复信息的数据
  const coachRepliesData = [
    {
      id: 1,
      sender: '教练1',
      message: '你的表现很棒，继续努力！',
      timestamp: new Date(),
    },
    {
      id: 2,
      sender: '教练2',
      message: '请注意下次课的时间变更。',
      timestamp: new Date(),
    },
    // 更多回复数据...
  ];

  //获取教练回复信息
  useEffect(()=>{
    async function getCoachMessage(){
      const res =await getCoachMessageAPI(getuserName())
      console.log(res.data)
      if(res.data !== '')
        {
          setCoachReplies(res.data)
        }
    }
    getCoachMessage()
  },[])

  const [coachReplies, setCoachReplies] = useState([]);

  return (
    <Layout>
      <Header style={{ background: '#fff', textAlign: 'center' }}>
        <h1 style={{ fontSize: '1.5rem' }}>教练回复</h1>
      </Header>
      <Content style={{ padding: '20px' }}>
        <List
          itemLayout="horizontal"
          dataSource={coachReplies}
          renderItem={(item) => (
            <List.Item key={item.evaluateId}>
              <List.Item.Meta
                avatar={<Avatar src={`https://i.pravatar.cc/150?u=${item.sender}`} />}
                title={`来自 ${item.coachName}`}
                description={item.coachEvaluateContent}
              />
            </List.Item>
          )}
        />
      </Content>
    </Layout>
  );
};

export default CoachReply;